package ch.janotta.slawo.da;

import java.util.HashMap;

public class Abilities extends HashMap<Ability, AbilityValue> {
  /**
   * serialVersionUID
   */
  private static final long serialVersionUID = -1261260184175694946L;

  public Abilities() {
    this.put(Ability.Communication, new AbilityValue(0));
    this.put(Ability.Communication, new AbilityValue(0));
    this.put(Ability.Constitution, new AbilityValue(0));
    this.put(Ability.Cunning, new AbilityValue(0));
    this.put(Ability.Dexterity, new AbilityValue(0));
    this.put(Ability.Magic, new AbilityValue(0));
    this.put(Ability.Perception, new AbilityValue(0));
    this.put(Ability.Strength, new AbilityValue(0));
    this.put(Ability.Willpower, new AbilityValue(0));
  }

  public Ability getMaximumAbility() {
    Ability maximumAbility = Ability.Communication;
    int maximumValue = this.get(Ability.Communication).getCurrentValue();
    if (this.get(Ability.Constitution).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Constitution;
      maximumValue = this.get(Ability.Constitution).getCurrentValue();
    }
    if (this.get(Ability.Cunning).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Cunning;
      maximumValue = this.get(Ability.Cunning).getCurrentValue();
    }
    if (this.get(Ability.Dexterity).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Dexterity;
      maximumValue = this.get(Ability.Dexterity).getCurrentValue();
    }
    if (this.get(Ability.Magic).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Magic;
      maximumValue = this.get(Ability.Magic).getCurrentValue();
    }
    if (this.get(Ability.Perception).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Perception;
      maximumValue = this.get(Ability.Perception).getCurrentValue();
    }
    if (this.get(Ability.Strength).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Strength;
      maximumValue = this.get(Ability.Strength).getCurrentValue();
    }
    if (this.get(Ability.Willpower).getCurrentValue() > maximumValue) {
      maximumAbility = Ability.Willpower;
      maximumValue = this.get(Ability.Willpower).getCurrentValue();
    }
    return maximumAbility;
  }

  public Ability getMaximumStartingAbility() {
    Ability maximumAbility = Ability.Communication;
    int maximumValue = this.get(Ability.Communication).getStartingValue();
    if (this.get(Ability.Constitution).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Constitution;
      maximumValue = this.get(Ability.Constitution).getStartingValue();
    }
    if (this.get(Ability.Cunning).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Cunning;
      maximumValue = this.get(Ability.Cunning).getStartingValue();
    }
    if (this.get(Ability.Dexterity).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Dexterity;
      maximumValue = this.get(Ability.Dexterity).getStartingValue();
    }
    if (this.get(Ability.Magic).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Magic;
      maximumValue = this.get(Ability.Magic).getStartingValue();
    }
    if (this.get(Ability.Perception).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Perception;
      maximumValue = this.get(Ability.Perception).getStartingValue();
    }
    if (this.get(Ability.Strength).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Strength;
      maximumValue = this.get(Ability.Strength).getStartingValue();
    }
    if (this.get(Ability.Willpower).getStartingValue() > maximumValue) {
      maximumAbility = Ability.Willpower;
      maximumValue = this.get(Ability.Willpower).getStartingValue();
    }
    return maximumAbility;
  }
}
